﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace ConsoleApplication1
{
    class Program
    {
        private static DataSet dss;
        static void Main(string[] args)
        {
            Program.SetData();
            Program.AddDs();
            if (Program.dss != null)
            {
                Console.Write(Program.dss.Tables[0].Rows.Count);
            }
        }

        public static void  SetData()
        {
            string[] strs = new string[] { "strName", "strAge", "strNo" };

            
            DataTable dt = new DataTable();
            DataColumn dc;

            for (int i = 0; i < strs.Length; i++)
            {
                dc = new DataColumn();
                dc.ColumnName = strs[i];
                dt.Columns.Add(dc);
            }
            dss = new DataSet();
            dss.Tables.Add(dt);

        }

        public static void AddDs()
        {
            DataRow dr = dss.Tables[0].NewRow();
            dss.Tables[0].Rows.Add(dr);


            int index = dss.Tables[0].Rows.Count-1;
            dss.Tables[0].Rows[index]["strName"] = "张三";
            dss.Tables[0].Rows[index]["strAge"] = "19";
            dss.Tables[0].Rows[index]["strNo"] = "20102355";
        }
    }
}
